<template>
  <div>
    home
    {{userInfo}}
    <button @click="logOut">退出</button>
    <button @click="getUserInfo">获得用户信息</button>
  </div>
</template>

<script>
    export default {
        name: "Home",
      data(){
          return {
            userInfo:[]
          }

      },
      methods:{
        getUserInfo(){
          this.$axios({
            url:'/getUserInfo',
            method:'post'
          }).then(suc=>{
            console.log("获得用户成功")
            userInfo = suc.data;
          }).catch(err=>{
            console.log("获得用户失败")
          })
        },
        logOut(){
          this.$axios({
            url:'/logout',
            method:'post'
          }).then(suc=>{
              console.log("注销成功")
          }).catch(err=>{
            console.log("注销失败")
          })
        }
      }
    }
</script>

<style scoped>

</style>
